import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:gold/app/user_provider.dart';
import 'package:gold/ui/index_page.dart';
import 'package:gold/ui/login/login_page.dart';

/// @description:
/// @author tangzhentao
/// @created at 18:50 2024/11/24

class RootPage extends StatelessWidget {
  const RootPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Selector<UserProvider, bool>(
      selector: (_, k) => k.isLogin,
      builder: (_, isLogin, __) {
        if (isLogin) {
          return const IndexPage();
        } else {
          return const LoginPage();
        }
      },
    );
  }
}
